package com.cyy.admin.repository;

import com.cyy.admin.entity.SysMenuEntity;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * 系统菜单表
 * 
 * @author chenyuyi
 * @date 2021-12-10 09:53:09
 *
 * 接口用法大全。
 * https://mapperhelper.github.io/all/
 */
@Repository
public interface SysMenuRepository extends JpaRepository<SysMenuEntity,String>, JpaSpecificationExecutor<SysMenuEntity> {

    @Query("select m from SysMenuEntity m left join RoleMenu r on m.id = r.mid where r.rid = ?1")
    List<SysMenuEntity> findAllByRoleId(String roleId);
}
